package com.example.xinai.Service.Impl;

import com.example.xinai.Entity.User;
import com.example.xinai.Mapper.UserMapper;
import com.example.xinai.Service.userLoadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

@Service
public class userLoadServiceImpl implements userLoadService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public User getUserByUsername(String telephone) {
        User user = userMapper.getUserByUsername(telephone);
        if(ObjectUtils.isEmpty( user)){
            return null;
        }else return user;
    }

    @Override
    public Integer getTelephone(String telephone) {
        return userMapper.getTelephone(telephone);
    }

    @Override
    public void saveUser(User user) {
        userMapper.saveUser(user);
    }
}
